
let herf = location.herf;//完整路径
console.log('href=' + herf)
let pathname = location.pathname;//路径名称
console.log('pathname=' + pathname)
let host = location.host;//主机+主机名
console.log('host=' + host)
let hostName = location.hostname; //主机名称
console.log('hostName=' + hostName)
let search = location.search; // 获取参数返回当前 URL 的查询部分（问号 ? 之后的部分）
console.log('search=' + search)
let port = location.port;
console.log('port=' + port)
let portocol = location.protocol;
console.log('portocol=' + portocol)

//找到class='link-btn'元素
let linkBtn = document.querySelector('.link-btn');
linkBtn.onclick = function () {
    //手动指定一个页面 让浏览器进行页面跳转
    location = './demo2.html';
    //不能返回的跳转
    //location.replace('./demo2.html')
}